package com.ewins.weatherdataclient.ui;

import com.ewins.weatherdataclient.common.Constant;
import com.ewins.weatherdataclient.https.HttpsDefault;
import com.ewins.weatherdataclient.interfacedatamodule.InterfaceDataManagerHttp;
import com.ewins.weatherdataclient.monitorpoolmodule.MonitorPoolModuleHttp;
import com.google.common.eventbus.EventBus;
import javafx.application.Application;
import javafx.stage.Stage;

import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by hp on 2015/12/7.
 */
public class MainHttp extends Application {

    public EventBus eb=new EventBus();
    ThreadPoolExecutor monitorPool;

    public static void main(String[] args) {

        Properties systemProps = System.getProperties();
        Constant.load();
        HttpsDefault.setDefaultValue();
        launch(args);
    }

    private void loadLog4j(){


    }

    public void start(Stage primaryStage) {

        monitorPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(Constant.DownLoadThreadCount);
        InterfaceDataManagerHttp interfaceDataManager=new InterfaceDataManagerHttp(eb,monitorPool);
        DownLoadMonitorFormHttp form = new DownLoadMonitorFormHttp();
        form.setLoadServer(interfaceDataManager);
        form.show();

//        DownloadMonitorUI downloadMonitorUI=new DownloadMonitorUI();
//        downloadMonitorUI.setLoadServer(interfaceDataManager);

        MonitorPoolModuleHttp mm=new MonitorPoolModuleHttp(eb,monitorPool);
    }

}